package sample;

public enum Number {
    ONE(new OneService()), TWO(new TwoService()), THREE(new ThreeService()),
    FOUR(new FourService()), FIVE(new FiveService()), SIX(new SixService());

    private final ServiceInterface serviceInterface;
    Number(ServiceInterface serviceInterface1) {
        this.serviceInterface = serviceInterface1;
    }

    public void handle() {
        serviceInterface.apply();
    }

    public static void main(String[] args) {
        String type = "TWO";
        Number number = Number.valueOf(type);
        number.handle();
    }
}
